from re import A
from django.contrib import admin

from .models import Banner, Category, Tag, Tui, Article, Link
#import database table

@admin.register(Article)
class ArticleAdmin(admin.ModelAdmin):
    list_display = ('id','category','title','tui','user','views','created_time')
    # 每页50条
    list_per_page = 50
    # 创建时间倒序
    ordering = ('-created_time',)
    # 点击进入编辑
    list_display_links = ('id','title')


@admin.register(Banner)
class BannerAdmin(admin.ModelAdmin):
    list_display = ('id','text_info','img','link_url','is_active')
    list_per_page  = 10


@admin.register(Category)
class CategoryAdmin(admin.ModelAdmin):
    list_display = ('id','name','index')


@admin.register(Tag)
class TagAdmin(admin.ModelAdmin):
    list_display = ('id','name')


@admin.register(Tui)
class TuiAdmin(admin.ModelAdmin):
    list_display = ('id','name')


@admin.register(Link)
class LinkAdmin(admin.ModelAdmin):
    list_display = ('id','name','linkurl')


